﻿

<html>
<head>
    <title>cbplayer demo</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=11" />
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" id="viewport" name="viewport">
    <style type="text/css">
        body,html{width:100%;height:100%;background:#000;padding:0;margin:0;overflow-x:hidden;overflow-y:hidden}
        *{margin:0;border:0;padding:0;text-decoration:none}
        #video{position:inherit}
    </style>
</head>
<body style="background:#000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu=window.event.returnValue=false>
<div id="video"></div>
<script src="//cdn.jsdelivr.net/npm/cdnbye@latest/dist/hlsjs-p2p-engine.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/hls.js@0.14.16"></script>
<script src="//cdn.jsdelivr.net/npm/cbplayer2@latest"></script>
<script>
   function getUrlParam(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
				var r = window.location.search.substr(1).match(reg); //匹配目标参数
				if(r != null) return unescape(r[2]);
				return null; //返回参数值
			};
    var url = getUrlParam('url');
    var cb = new CBPlayer({
        container: document.getElementById('video'),
        autoplay: true,
        hotkey: true,  // 移动端全屏时向右划动快进，向左划动快退。
        video: {
            url:url,
            // pic: 'loading_wap.gif',
        },
        pluginOptions: {
            hls: {
                p2pConfig: {
                    logLevel: false,
                    // Other p2pConfig options provided by CDNBye
                }
            }
        },
    });
    cb.on('fullscreen', function () {
        if (/Android|webOS|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
            screen.orientation.lock('landscape');
        }
    });
</script>
</body>
</html>
